<?php


namespace App\Admin\Extensions\Show;

use Dcat\Admin\Show\AbstractField;

class ReservationImgs extends AbstractField
{
    // 这个属性设置为false则不会转义HTML代码
    public $escape = false;

    public function render()
    {

        $dataInfo = $this->payload['imgs'];
        $dataInfo = json_decode($dataInfo, true);
        $img_html_str = '';
        foreach ($dataInfo as $dataInfoVal) {
            if ($dataInfoVal) {
                $img_html_str .= "<img data-action='preview-img' src='".config('app.url').'/uploads/'.$dataInfoVal."' style='max-height:60px;cursor:pointer' class='img img-thumbnail' />";
            }
        }

        return [$img_html_str];

    }

}